package com.example.dell.fastshopping;

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.example.dell.fastshopping.utils.KLog;
import com.example.dell.fastshopping.utils.Utils;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.tencent.tauth.Tencent;

import java.util.ArrayList;
import java.util.List;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by ${YSH} on 2019/4/18.
 * 描述        ${TODO}
 * <p>
 * 更新者       $author$
 * 更新时间     $Data$
 * 描述         ${TODO}
 * 极光推送：daerkj@163.com = daeryfb
 * 微信开发者：appid/key:wx85d717422d777d09/c12cbff36490363842d34d7ba7594097
 * 腾讯开发者：appid/key:101582018/3b3949e6393910fc1f1ffee3881dc85f
 */
public class MyApplication extends Application {

    //竞拍页数据缓存 TODO:待想到好的解决办法 ，竞拍后 要求下次进来该场次该轮状态还是已竞拍状态
    private static List saveData = new ArrayList<String>();
    private String WX_APPID = "wx85d717422d777d09/c12cbff36490363842d34d7ba7594097";
    private static String TenXun_APPID = "101582018/3b3949e6393910fc1f1ffee3881dc85f";
    private static IWXAPI wxApi;
    private static Tencent mTencent;

    public static void saveData(String s) {
        saveData.add(s);
        if (saveData.size() > 10) {
            saveData.remove(0);
        }
    }

    public static List getSaveData() {
        return saveData;
    }

    public static void removeData(String s) {
        if (saveData.contains(s)) {
            saveData.remove(s);
        }
    }

    public static IWXAPI getWxAPI() {
        return wxApi;
    }

    public static Tencent getQQAPI() {
        return mTencent;
    }


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Utils.init(this);
        KLog.init(true);
        JPushInterface.setDebugMode(true);

        wxApi = WXAPIFactory.createWXAPI(this, WX_APPID, true);
        wxApi.registerApp(WX_APPID);
       // mTencent = Tencent.createInstance(TenXun_APPID, this.getApplicationContext());
    }
}
